﻿<%@ Page Language="C#" MasterPageFile="~/GUIMaster.Master" AutoEventWireup="true"
    CodeBehind="tripDetail.aspx.cs" Inherits="TripLOA.GUI.secure.tripDetail" Title="Untitled Page"
    Culture="auto" meta:resourcekey="PageResource1" UICulture="auto" %>
    
<%@ Register Assembly="MapControl2" Namespace="MapControl2" TagPrefix="map" %>
<%@ Register TagPrefix="TestAscx" TagName="ExampleControl" Src="~/Controllo_Ascx/ExampleTemplate.ascx"  %>

    
<%@ Register src="../PeriodicTripControl/PeriodicTrip.ascx" tagname="PeriodicTrip" tagprefix="uc1" %>
<%@ Register Assembly="MapControl2" Namespace="MapControl2" TagPrefix="map" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

<link href="../PeriodicTripControl/periodicTrip.css" type="text/css" rel="stylesheet" />

<script type="text/javascript" src="../PeriodicTripControl/periodicTrip.js"></script>

    <link href="../master/resourcesNew/style.css" rel="stylesheet" type="text/css" />
    
    <style type="text/css">
        table.formTable {
            width: 430px;	
        }
        td.formLabel {
        	text-align: left;
        }
        td.formTextbox {
        	width: 200px;
        }     
       
    </style>
   
   
    <script src="/common/geoCodingMenu/AAAGeoCodingMenu.js" type="text/javascript"></script>
     
     <script type="text/javascript">
     //------------GEOREF INTERACTION
        
        function SwapEditable()
        {
            var mapControl = Sys.Application.findComponent("ctl00_ContentHomePage_map_1");
            mapControl.transformToEditableMap();

        }
        function updateGeoCodingMenu(){
              var startTextBox=document.getElementById("<%=txtDepartureEdit.ClientID%>");
              var endTextBox=document.getElementById("<%=txtArrivalEdit.ClientID%>");
              if((startTextBox!=null)&&(startTextBox!=undefined))
              {
                if(startTextBox.menuStatus == 1){
                   startTextBox.showMenu();
                } 
              }
              if((endTextBox!=null)&&(endTextBox!=undefined))
              {        
                if(endTextBox.menuStatus == 1){
                    endTextBox.showMenu();
                }
              } 
       }
        function showHideDivInstr(){
            var divin=document.getElementById("divinstruction");
	    	var button=document.getElementById("ShowHideDivistruction");
	    	if(divin.style.display=="none")
            {
                button.value='<%=this.GetLocalResourceObject("HideGuideInstr")%>';  
                $("div#divinstruction").show("fast",updateGeoCodingMenu);
                
                guideInstruction();
            }
            else{
                    button.value='<%=this.GetLocalResourceObject("ShowGuideInstr")%>';  
                    $("div#divinstruction").hide("fast",updateGeoCodingMenu);
            }
        }
        function guideInstruction()
        {
            var map_ctrl = Sys.Application.findComponent("<%=map_1.ClientID%>");
            
            var trip = null;
            if(map_ctrl.getGMap().isEditable() )
                 trip = map_ctrl._map._editableTrip;
            else
                trip = map_ctrl._map._trips[0]
            
            if(trip != null)
                if(trip._routes.length>0)
                {
                    getIstructions ("divinstruction",trip);
                    return;
                }
            
            var divin=document.getElementById("divinstruction"); 
            divin.innerHTML = "";
        }
        
        function synchro(){

            return SincronizeLOAMapControl("<%=map_1.ClientID%>");
        }
    
        function InsertTrip(sender)
        {
            var dep = document.getElementById("<%=txtDepartureEdit.ClientID%>");
           
            var arr = document.getElementById("<%=txtArrivalEdit.ClientID%>");
            var from = MapControl2.AAAUtils.createGeoLocFromGeoCodingQuery(dep.latitude, dep.longitude, dep.value);
            var to = MapControl2.AAAUtils.createGeoLocFromGeoCodingQuery(arr.latitude, arr.longitude, arr.value);
            var loamap = Sys.Application.findComponent("<%=map_1.ClientID%>");
               
            if(dep.GetStatus() == GUI.AAAGeoCodingMenu.READY && arr.GetStatus() == GUI.AAAGeoCodingMenu.READY) {
                var editableTrip = loamap.getGMap().getEditableTrip();
                var vehicleCbo = $get("<%=ddlVehicle.ClientID%>");
                
                if (editableTrip == null){
                        if(vehicleCbo==null) {
                            loamap.setEditableTripA2BFromGeolocs([from, to]);                        
                        }
                        else{
                            vehicl = loamap.getVehicleById(vehicleCbo.value);
                            loamap.setEditableTripA2BFromGeolocs([from, to],vehicl);
                        }
                }
                else
                    switch(sender){
                        case 0:
                            editableTrip.setStart(from);
                        break;
                        case 1:
                            editableTrip.setEnd(to);
                        break;
                        case 2:
                             vehicl = loamap.getVehicleById(vehicleCbo.value);
                             editableTrip.setVehicle(vehicl);
                        break;
                    }
            }
            else if(dep.GetStatus() == GUI.AAAGeoCodingMenu.ERROR || arr.GetStatus() == GUI.AAAGeoCodingMenu.ERROR)
                loamap.getGMap().clearEditableTrip(); 
        }
        
         function attachMenu()
        {
            var map_ctrl = Sys.Application.findComponent("<%=map_1.ClientID%>");
            if( !map_ctrl.getGMap().isEditable() )
                return;
            
            var departureId = "<%=txtDepartureEdit.ClientID %>";
            var departureNode = document.getElementById(departureId);
            GUI.AAAGeoCodingMenu(departureNode, GUI.AAAGeoCodingMenu.RIGHT, GUI.AAAGeoCodingMenu.UP);
            departureNode.geocodeFail='<%= this.GetGlobalResourceObject("TripLoaResource","GeocodFail") %>';
            departureNode.locNotFound='<%= this.GetGlobalResourceObject("TripLoaResource","LocFail") %>';
            
            var arriveId = "<%=txtArrivalEdit.ClientID %>";
            var arriveNode = document.getElementById(arriveId);
            
            GUI.AAAGeoCodingMenu(arriveNode);
            arriveNode.geocodeFail='<%= this.GetGlobalResourceObject("TripLoaResource","GeocodFail") %>';
            arriveNode.locNotFound='<%= this.GetGlobalResourceObject("TripLoaResource","LocFail") %>';
           
           function draw(event) 
            {
                if (event.controlStatus == GUI.AAAGeoCodingMenu.READY || event.controlStatus == GUI.AAAGeoCodingMenu.ERROR) 
                {
                    if ((event.target.id == departureId) && (departureNode.GetStatus() == GUI.AAAGeoCodingMenu.READY))
                        InsertTrip(0);
                    else
                        InsertTrip(1);
                }                    
            };
            
            arriveNode.statusHandler(draw);
            departureNode.statusHandler(draw);
        
            var depGL = map_ctrl.getStartGeoloc();
            map_ctrl.setDepBox(departureNode);
            departureNode.setGeoloc(depGL);
        
            var arrGL = map_ctrl.getEndGeoloc();
            map_ctrl.setArrBox(arriveNode);
            arriveNode.setGeoloc(arrGL);
            
            var vehicleCbo = $get("<%=ddlVehicle.ClientID%>");
            if(vehicleCbo!=null)
                map_ctrl.setVehicleCbo(vehicleCbo);   
            
            
        }
        
        function forceStopBind()
        {
            var map_ctrl = Sys.Application.findComponent("<%=map_1.ClientID%>");
            map_ctrl.getGMap().setEditable(false);
            google.maps.Event.clearInstanceListeners(map_ctrl.getGMap());
        }
        
        function bindMapEvents()
        {         
            var map_ctrl = Sys.Application.findComponent("<%=map_1.ClientID%>");
            if( !map_ctrl.getGMap().isEditable() )
            {
                google.maps.Event.clearInstanceListeners(map_ctrl.getGMap());
                return;
            }
            google.maps.Event.addListener(map_ctrl.getGMap(), 'tripload', onTripChange);
            google.maps.Event.addListener(map_ctrl.getGMap(), 'tripchange', onTripChange);
            google.maps.Event.addListener(map_ctrl.getGMap(), 'tripclear', onTripClear);
            
            attachMenu();
        }
        function onTripClear()
        {
            fBox = $get("<%=txtDepartureEdit.ClientID%>"); 
            tBox   = $get("<%=txtArrivalEdit.ClientID%>");
            fBox.value = "";
            tBox.value = "";                
            
            var divin=document.getElementById("divinstruction");
            divin.innerHTML = "";
        }
             
        function onTripChange(trip)
        {         
            fBox = $get("<%=txtDepartureEdit.ClientID%>"); 
            tBox = $get("<%=txtArrivalEdit.ClientID%>");
            route = trip.getTripModel().routes;
            
            if(fBox == null || tBox == null )
                return;
            
            if(fBox.setGeoloc == null)
                attachMenu();
            
            fBox.setGeoloc(route[0].start);
            tBox.setGeoloc(route[route.length-1].end);                
            
            var divin=document.getElementById("divinstruction");
	    	if(divin.style.display!="none") guideInstruction();
        }        
        
    //end georef interaction
   
         function confirmSubmit() 
         {
            var str ='<%=this.GetLocalResourceObject("confirmDel")%>';
            var res=confirm(str);
            if (res)
                return true;
            else
                return false;
         }

    </script>
  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentHomePage" runat="server">
      
    <div id="tripDetails">
        <h1>
            <asp:Label ID="lblTitle" runat="server" meta:resourcekey="lblTitleResource"></asp:Label>
        </h1>
        <div id="map_header_detail"></div>
        <div id="map_line_detail">
            <div id="Map" style="width:700px; height:500px; margin-left: 28px;"> </div></div>
        <div id="map_footer_detail"></div>
      <asp:UpdatePanel ID="UpdatePanelMap" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <map:LOAMap ID="map_1" runat="server" MapDiv="Map" ZoomLevel="10"  Editable="false" />    
                <script type="text/javascript">
                         mapStrings["add_destination"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoMenuAddDest") %>';
                        mapStrings["remove_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoMenuRemTrip") %>';
                        mapStrings["select_vehicle"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoMenuSelVehicle") %>';
                        mapStrings["insert_waypoint"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoMenuInsWay") %>';
                        mapStrings["take_in_passenger"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoMenuTakeInPass") %>';
                        mapStrings["take_off_passenger"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoMenuTakeOffPass") %>';
                        mapStrings["detach_passenger"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoMenuDetachPass") %>';
                        mapStrings["detach_from_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoMenuDetachTrip") %>';
                        
                        mapStrings["start_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeosInfoRoute") %>';
                        mapStrings["startDescr_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeosDescrInfoRoute") %>';
                        mapStrings["end_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoeInfoRoute") %>';
                        mapStrings["endDescr_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoeDescrInfoRoute") %>';
                        mapStrings["dist_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoDistInfoRoute") %>';
                        mapStrings["time_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoTimeInfoRoute") %>';
                        mapStrings["wayNumb_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeonWayInfoRoute") %>';
                        mapStrings["title_info_route"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoTitleInfoRoute") %>';
                        
                        mapStrings["start_info_trip"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeosInfoTrip") %>';
                        mapStrings["startDescr_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeosDescrInfoTrip") %>';
                        mapStrings["end_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoeInfoTrip") %>';
                        mapStrings["endDescr_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoeDescrInfoTrip") %>';
                        mapStrings["dist_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoDistInfoTrip") %>';
                        mapStrings["time_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoTimeInfoTrip") %>';
                        mapStrings["routeN_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeonRoutesInfoTrip") %>';
                        mapStrings["title_info_trip"]='<%= this.GetGlobalResourceObject("TripLoaResource","GeoTitleInfoTrip") %>';
                    
                        mapStrings["endLabel_trip"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoEndLabel") %>';
                        mapStrings["end_trip"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoEndTrip") %>';
                        mapStrings["endDescr_trip"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoEndDescr") %>';

                        mapStrings["waypointLabel"]= '<%=this.GetGlobalResourceObject("TripLoaResource","GeoWayLabel") %>';
                        mapStrings["waypoint_Location"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoWayLoc") %>';
                        mapStrings["waypoint_Descr"]='<%=this.GetGlobalResourceObject("TripLoaResource","GeoWayDescr") %>';
                    </script>
        </ContentTemplate>
    </asp:UpdatePanel>  
    <br />
    <asp:Panel ID="Expiration_trip" runat="server" Visible="false">
        <div id="divAlertExpired_header" class="alert_header" ></div>
        <div id="divAlertExpired_line" class="line_alert_message" >
            <div id="divAlertExpired_content" class="alert_content_message">
                <asp:Label ID="lblTripExpirated" runat="server" meta:resourcekey="lblTripExpiratedResource" Text="Il viaggio è scaduto!!"></asp:Label>
            </div>
        </div>
     <div id="divAlertExpired_footer"  class="alert_footer" ></div>
        </asp:Panel>
        <div id="content_trip_detail">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
            <ContentTemplate>
                <asp:MultiView ID="detailMultiView" runat="server" OnActiveViewChanged="changeViewEvent">
                    <asp:View ID="staticDetailView" runat="server">
                        <asp:Table ID="tblStaticDetailView" runat="server">
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="DepartureLabel"  CssClass="label_title" runat="server" meta:resourcekey="DepartureLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="DepartureContent" runat="server" meta:resourcekey="DepartureContentResource1"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="ArrivalLabel" CssClass="label_title" Text="Arrival:" runat="server" meta:resourcekey="ArrivalLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="ArrivalContent" runat="server" ></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="VehicleLabel" CssClass="label_title" Text="Vehicle:" runat="server" meta:resourcekey="VehicleLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="VehicleContent" runat="server" meta:resourcekey="VehicleContentResource1"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow ID="rowIsFrequent" runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="lblIsFrequent" CssClass="label_title" runat="server" meta:resourcekey="lblIsFrequentRes"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:CheckBox ID="CheckBoxFrequentContent" Enabled="false" runat="server" />
                                    <asp:Button ID="btnShowFrequencyDetails"  CssClass="button_generics" runat="server" meta:resourcekey="btnShowFrequencyDetailsRes" OnClientClick="showPeriodicTripControl();"/>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow ID="rowFromFrequent" runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="lblFromFrequent" CssClass="label_title" runat="server" meta:resourcekey="lblFromFrequentRes"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="lblFromFrequentContent"  runat="server"></asp:Label>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow ID="rowToFrequent" runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="lblToFrequent" CssClass="label_title" runat="server" meta:resourcekey="lblToFrequentRes"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="lblToFrequentContent"  runat="server"></asp:Label>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow ID="rowDateNotFrequent" runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="DateLabel" CssClass="label_title" Text="Date:" runat="server" meta:resourcekey="DateLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="DateContent" runat="server" meta:resourcekey="DateContentResource1"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="ResExpDate" CssClass="label_title" Text="Reservation expiration date:" runat="server" meta:resourcekey="ResExpDateResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="ResExpContent" runat="server" meta:resourcekey="ResExpContentResource1"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowDevRad">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="DevRadLabel" CssClass="label_title" Text="Deviation Radius:" runat="server" meta:resourcekey="DevRadLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="DevRadContent" runat="server" meta:resourcekey="DevRadContentResource1"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow ID="rowSmoker" runat="server" meta:resourcekey="rowSmokerResource1">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="AccSmokeLabel" CssClass="label_title" Text="Accept smokers:" runat="server" meta:resourcekey="AccSmokeLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:CheckBox ID="AccSmokerCheckBoxContent" Enabled="false" runat="server" />
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowReqLic">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="ReqLicLabel" CssClass="label_title" Text="Required driver licence:" runat="server" meta:resourcekey="ReqLicLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:CheckBox ID="ReqLicCheckBoxContent" Enabled="false" runat="server" />
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowFreeSeat">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="FreeSeatLabel" CssClass="label_title" Text="Number of free seats:" runat="server" meta:resourcekey="FreeSeatLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="FreeSeatContent" runat="server" meta:resourcekey="FreeSeatContentResource1"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowEstBudget">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="estBudgetLabel" CssClass="label_title" Text="Estimated budget:" runat="server" meta:resourcekey="estBudgetLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="estBudgetContent" runat="server" meta:resourcekey="estBudgetContentResource1"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="estTimeLabel" CssClass="label_title" Text="Estimated travel time:" runat="server" meta:resourcekey="estTimeLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="estTimeContent" runat="server" meta:resourcekey="estTimeContentResource1"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="noteLabel" CssClass="label_title" Text="Notes:" runat="server" meta:resourcekey="noteLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Label ID="noteContent" runat="server" meta:resourcekey="noteContentResource1"></asp:Label></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Label ID="draftLabel" CssClass="label_title" Text="Draft:" runat="server" meta:resourcekey="draftLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:CheckBox ID="DraftCheckBoxContent" Enabled="false" runat="server" />
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowBtnEdit">
                                <asp:TableCell runat="server"></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Button ID="startModButton"  CssClass="button_generics" runat="server" Text="Modify" OnClick="startModButton_Click"
                                        meta:resourcekey="startModButtonResource1" OnClientClick="SwapEditable();" /></asp:TableCell>
                                    <asp:TableCell><asp:Button ID="buttonDelete" CssClass="button_generics" runat="server" Text="Delete"
                                        meta:resourcekey="buttonDeleteResource1" OnClick="buttonDelete_Click" 
                                            OnClientClick="if(!confirmSubmit())return false;" /></asp:TableCell>
                            </asp:TableRow>

                            
                     </asp:Table>
                    </asp:View>
                    <asp:View ID="modView" runat="server" OnActivate="activateControl" >
                    
                        <asp:UpdatePanel ID="UpdatePanelModeView" UpdateMode="Conditional" runat="server">
                        <ContentTemplate>
                        
                        <asp:Table ID="tblModeView" runat="server" CssClass="formTable">
                            <asp:TableRow runat="server">
                                <asp:TableCell CssClass="formLabel">
                                    <asp:Label ID="lblDepartureEdit" CssClass="label_title" runat="server" meta:resourcekey="DepartureLabelResource1" ></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell CssClass="formTextbox">
                                    <asp:TextBox ID="txtDepartureEdit" CssClass="txtBox_generics" runat="server" onchange="InsertTrip()"></asp:TextBox>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server">
                                <asp:TableCell CssClass="formLabel">
                                    <asp:Label ID="lblArrivalEdit" CssClass="label_title" runat="server" meta:resourcekey="ArrivalLabelResource1"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:TextBox ID="txtArrivalEdit" CssClass="txtBox_generics" runat="server" onchange="InsertTrip()"></asp:TextBox>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="lblFrequent" CssClass="label_title" runat="server" meta:resourcekey="lblIsFrequentRes"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:UpdatePanel ID="UpdatePanelCheckBoxFrequent" runat="server">
                                    <ContentTemplate>
                                    
                                    <asp:CheckBox ID="CheckBoxFrequent" AutoPostBack="true" OnCheckedChanged="ChangedFrequency" runat="server" />
                                    </ContentTemplate>
                                    </asp:UpdatePanel>
                                    <asp:Button ID="btnShowOptionsFrequency" CssClass="button_generics" Visible="false" runat="server" meta:resourcekey="btnShowFrequencyDetailsRes" OnClientClick="showPeriodicTripControl();" />
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowFromDayFrequencyEdit">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="lblFromDayFrequencyEdit" CssClass="label_title" runat="server" meta:resourcekey="lblFromFrequentRes"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:TextBox ID="txtFromDayFrequencyEdit" CssClass="txtBox_generics" runat="server"></asp:TextBox>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowToDayFrequencyEdit">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="lblToDayFrequencyEdit" CssClass="label_title" runat="server" meta:resourcekey="lblToFrequentRes"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:TextBox ID="txtToDayFrequencyEdit" CssClass="txtBox_generics" runat="server"></asp:TextBox>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowDepartureDateEdit">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="modDateLabel"  CssClass="label_title" Text="Date:" runat="server" meta:resourcekey="modDateLabelResource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:TextBox ID="dateTbox" CssClass="txtBox_generics" runat="server" meta:resourcekey="dateTboxResource1"></asp:TextBox></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowStartTimeEdit">
                                <asp:TableCell CssClass="formLabel">
                                    <asp:Label ID="lblStartTimeEdit" CssClass="label_title" runat="server" Text="Hour:" meta:resourcekey="lblStartTimeEditResource"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:TextBox ID="txtStartTimeEdit" CssClass="txtBox_generics" runat="server"></asp:TextBox>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowArrivalDateEdit">
                                <asp:TableCell CssClass="formLabel">
                                    <asp:Label ID="lblArrivalDate" CssClass="label_title" runat="server" meta:resourcekey="lblArrivalDateResource"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:TextBox ID="txtArrivalDate" CssClass="txtBox_generics" runat="server"></asp:TextBox>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow ID="rowEndTimeEdit" runat="server">
                                <asp:TableCell CssClass="formLabel">
                                    <asp:Label ID="lblEndTimeEdit" CssClass="label_title" runat="server" meta:resourcekey="lblEndTimeEditResource"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:TextBox ID="txtEndTimeEdit" CssClass="txtBox_generics" runat="server"></asp:TextBox>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowResExpDate">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="ResExpDate2" CssClass="label_title" Text="Reservation expiration date:" runat="server" meta:resourcekey="ResExpDate2Resource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:TextBox ID="resExpDateTBox" CssClass="txtBox_generics" runat="server" meta:resourcekey="resExpDateTBoxResource1"></asp:TextBox></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowHourExpDate">
                                <asp:TableCell CssClass="formLabel">
                                    <asp:Label ID="lblHourExpEdit" CssClass="label_title" runat="server" Text="Hour:" meta:resourcekey="lblHourExpEditResource"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:TextBox ID="txtHourExpEdit" CssClass="txtBox_generics" runat="server"></asp:TextBox>
                                </asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowDeviationEdit">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="DevRadLabel2" CssClass="label_title" Text="Deviation Radius:" runat="server" meta:resourcekey="DevRadLabel2Resource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:TextBox ID="devRadTBox" CssClass="txtBox_generics" runat="server" meta:resourcekey="devRadTBoxResource1"></asp:TextBox></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow ID="rowSmokerEdit" runat="server" meta:resourcekey="rowSmokerEditResource1">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="AccSmokeLabel2" CssClass="label_title" Text="Accept smokers:" runat="server" meta:resourcekey="AccSmokeLabel2Resource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:CheckBox ID="accSmokeCBox" runat="server" meta:resourcekey="accSmokeCBoxResource1" /></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowRequiredLicenseDriverEdit">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="ReqLicLabel2" CssClass="label_title" Text="Required driver licence:" runat="server" meta:resourcekey="ReqLicLabel2Resource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:CheckBox ID="reqLicCbox" runat="server" meta:resourcekey="reqLicCboxResource1" /></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowFreeSeatsEdit">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="FreeSeatLabel2" CssClass="label_title" Text="Number of free seats:" runat="server" meta:resourcekey="FreeSeatLabel2Resource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:TextBox ID="freeSeatTbox" CssClass="txtBox_generics" runat="server" meta:resourcekey="freeSeatTboxResource1"></asp:TextBox></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowEstimatedBudgetEdit">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="estBudgetLabel2" CssClass="label_title" Text="Estimated budget:" runat="server" meta:resourcekey="estBudgetLabel2Resource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:TextBox ID="esBudgetTBox" CssClass="txtBox_generics" runat="server" meta:resourcekey="esBudgetTBoxResource1"></asp:TextBox></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowEstimatedTravelTimeEdit">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="estTimeLabel2" CssClass="label_title" Text="Estimated travel time:" runat="server" meta:resourcekey="estTimeLabel2Resource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:TextBox ID="esTimeTBox" CssClass="txtBox_generics" runat="server" meta:resourcekey="esTimeTBoxResource1"></asp:TextBox></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server" ID="rowNotesEdit">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="noteLabel2" CssClass="label_title" Text="Notes:" runat="server" meta:resourcekey="noteLabel2Resource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:TextBox ID="noteTBox" CssClass="txtBox_generics" Columns="25" Rows="8" runat="server" meta:resourcekey="noteTBoxResource1" TextMode="MultiLine"></asp:TextBox></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server" CssClass="formLabel">
                                    <asp:Label ID="draftLabel2" CssClass="label_title" Text="Draft:" runat="server" meta:resourcekey="draftLabel2Resource1"></asp:Label></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:CheckBox ID="draftCbox" runat="server" meta:resourcekey="draftCboxResource1" /></asp:TableCell>
                            </asp:TableRow>
                            <asp:TableRow ID="TableRowVehicles"  runat="server" Visible="false" VerticalAlign="Top">
                                <asp:TableCell ID="TableCell1" runat="server" CssClass="formLabel">
                                    <asp:Label ID="lblVehiEdit" CssClass="label_title" runat="server" Text="Vehicle"></asp:Label>
                                </asp:TableCell>
                                <asp:TableCell>
                                    <asp:UpdatePanel ID="vehicleupdate" runat="server">
                                    <ContentTemplate>
                                    <asp:DropDownList ID="ddlVehicle" runat="server" CssClass="txtBox_generics" 
                                         onselectedindexchanged="ddlVehicle_SelectedIndexChanged" AutoPostBack="true" onchange="InsertTrip(2)">
                                    </asp:DropDownList>
                                    </ContentTemplate>
                                    </asp:UpdatePanel>
                                </asp:TableCell>
                            </asp:TableRow>
                            </asp:Table>
                            
                            <div ID="TableRowVehiclesControl" runat="server" >
                                    <asp:UpdatePanel ID="updatePanelVehiclesControl" runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
                                            <TestAscx:ExampleControl ID="VehiclesControl"  runat="server" />
                                        </ContentTemplate>
                                    </asp:UpdatePanel> 
                            </div>
                            <asp:Table runat="server">
                            <asp:TableRow runat="server">
                                <asp:TableCell runat="server">
                                    <asp:Button ID="acceptModButton"  CssClass="button_generics" runat="server" Text="Accept" OnClientClick="return synchro();" OnClick="acceptModButton_Click"
                                        meta:resourcekey="acceptModButtonResource1"/></asp:TableCell>
                                <asp:TableCell runat="server">
                                    <asp:Button ID="cancelModButton" CssClass="button_generics" runat="server" Text="Cancel" OnClick="cancelModButton_Click" OnClientClick="forceStopBind()"
                                        meta:resourcekey="cancelModButtonResource1" /></asp:TableCell>
                            </asp:TableRow>
                        </asp:Table>
                         
                        </ContentTemplate>
                        </asp:UpdatePanel>
                        
                    </asp:View>
                </asp:MultiView>
            </ContentTemplate>
        </asp:UpdatePanel>
        
        <asp:UpdatePanel ID="UpdatePanelPeriodicTrip" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
        <div id="frequencytrip" >
            <uc1:PeriodicTrip ID="ptc" Editable="true" runat="server" />  
         </div> 
        </ContentTemplate>
        </asp:UpdatePanel>
         
    </div>
    
    <asp:Panel ID="panel_request" runat="server" Visible="true">
    <div id="requests">
    <div id="header_content_request"></div>
    <div id="line_content_request">
        <asp:Label ID="lblAcceptRequests" runat="server" Text="Accept Requests" CssClass="label_title"
            meta:resourcekey="lblAcceptRequestsResource1"></asp:Label>
        <asp:GridView ID="GridViewAcceptRequests" AutoGenerateColumns="false" runat="server" meta:resourcekey="GridViewAcceptRequestsResource1" GridLines="None" CellSpacing="2" CellPadding="5">
            <Columns>
                <asp:TemplateField meta:resourcekey="BoundFieldUsernameAcceptedReosurce">
                <ItemStyle HorizontalAlign="Left"></ItemStyle>
               <ItemTemplate>
                   <asp:HyperLink ID="HyperLinkNick2" NavigateUrl='<%# "~/secure/userProfile.aspx?Nick=" +  Eval("Username") %>' runat="server"><%# Eval("Username") %></asp:HyperLink>
               </ItemTemplate>
               </asp:TemplateField>
                <asp:BoundField DataField="SeatsNo" meta:resourcekey="BoundFieldSeatsAcceptedResource" ItemStyle-HorizontalAlign="Center"/>
            </Columns>
        
        </asp:GridView>
        <asp:Label ID="lblPendingRequest" runat="server" Text="Pending Requests" CssClass="label_title"
            meta:resourcekey="lblPendingRequestResource1"></asp:Label>
        <asp:GridView ID="GridViewPendingRequests" AutoGenerateColumns="False" runat="server"
            OnSelectedIndexChanging="GridViewPendingRequests_OnSelectedIndexChanging" GridLines="None"
            CellSpacing="2" CellPadding="5" DataKeyNames="UserId" OnRowDeleting="GridViewPendingRequests_OnRowDeleting"
            meta:resourcekey="GridViewPendingRequestsResource1">
            <Columns>
                <asp:BoundField DataField="Date" HeaderText="Reservation Date" ItemStyle-HorizontalAlign="Center"
                    meta:resourcekey="BoundFieldResource1">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:BoundField>
                <asp:TemplateField meta:resourcekey="BoundFieldResource2">
                <ItemStyle HorizontalAlign="Center"></ItemStyle>
               <ItemTemplate>
                   <asp:HyperLink ID="HyperLinkNick" NavigateUrl='<%# "~/secure/userProfile.aspx?Nick=" +  Eval("Username") %>' runat="server"><%# Eval("Username") %></asp:HyperLink>
               </ItemTemplate>
               </asp:TemplateField>
                <asp:BoundField DataField="SeatsNo" HeaderText="Reserved Seats" ItemStyle-HorizontalAlign="Center"
                    meta:resourcekey="BoundFieldResource3">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:BoundField>
                <asp:BoundField DataField="Notes" HeaderText="Notes" ItemStyle-HorizontalAlign="Left"
                    meta:resourcekey="BoundFieldResource4">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundField>
                
                <asp:CommandField CausesValidation="false" ShowSelectButton="true" SelectText="Accetta Passeggero"
                    meta:resourcekey="CommandFieldResource1" />
                <asp:CommandField CausesValidation="false" ShowDeleteButton="true" DeleteText="Elimina la prenotazione"
                    meta:resourcekey="CommandFieldResource2" />
            </Columns>
        </asp:GridView>
       </div>
       <div id="footer_content_request"></div>
       </asp:Panel>
    </div>
    </div>
    <br />
    <input id="ShowHideDivistruction" type="button" onclick="showHideDivInstr();" value="<%= this.GetLocalResourceObject("ShowGuideInstr") %>" />
   
    <div id="divinstruction" style="display:none; height:300px; width: 700px; overflow:scroll" >
        
    </div>
   
    
</asp:Content>
